package com.adou.second.day10;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class ObjectOutputDemo {

	public static void main(String[] args) throws Exception {
//		Student stu = new Student();
//		stu.setName("张三");
//		stu.setChinese(98);
//		stu.setMath(97);
//		stu.setEnglish(100);
//		
//		// 序列换 文件
//		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("fos\\stu\\student2.txt"));
//		oos.writeObject(stu);
//		oos.close();
//		
		// 反序列换
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream("fos\\stu\\student2.txt"));
		Student stu2 = (Student)ois.readObject();
		System.out.println(stu2);
		
		
	}

}
